<template>
    <div>
        <table>
            <tr v-for="i in list_" :key="i.id">
                <td>{{i.name}}</td>
                <td @click="btn">离开</td>
            </tr>
        </table>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data () {
        return {
            list_:[],
            id:this.$router.query.id,
        }
    },
    created () {
        axios.get('http://127.0.0.1:8000/user/eat/',{id:id}).then((res)=>{
            this.list_ = res.data
        })
    },
    methods: {
        btn(){
            axios.put('http://127.0.0.1:8000/user/end/').then((res)=>{
                alert(res.data.msg)
            })
        }
    }
}
</script>

<style>

</style>